package org.fund.controller;

import org.fund.base_service.domain.IncomeRecord;
import org.fund.base_service.service.IncomeRecordService;
import org.fund.base_service.service.impl.TempFundService;
import org.fund.common.core.domain.BaseResult;
import org.fund.common.model.FundValueEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Author Moro
 * @Date 2022/3/23 23:05
 * @title TestController
 */
@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    private TempFundService service;
    @Autowired
    private IncomeRecordService recordService;
    @GetMapping("/testInsert")
    public void insert(){
        service.batchInsert();
    }
    @GetMapping("/testjz")
    public BaseResult testjz(){
        Map<String, FundValueEntity> stringFundValueEntityMap = service.queryByFundCodeAndDate("2022-03-23");
        return BaseResult.success(stringFundValueEntityMap);
    }
    @GetMapping("/testincome")
    public BaseResult testincome(){
        List<IncomeRecord> incomeRecordList = recordService.calculateIncome();
        return BaseResult.success(incomeRecordList);
    }
        @GetMapping("/testInsertRecord")
    public BaseResult testInsertRecord(){
        List<IncomeRecord> incomeRecordList = recordService.calculateIncome();
            int i = recordService.batchInsert(incomeRecordList);
            return BaseResult.success(i );
    }


}
